#!/bin/sh

. scripts/functions

#
# Run a simple backup.
#

TestName="`basename $0`"
Client=susan-fd
JobName=backup-susan-fd
BackupDirectory="${cwd}/build/autoconf/"

NewClient="dynclient1-fd"

cleanup

copy_configs

start_test

cat <<END_OF_DATA >${tmp}/bconcmds
messages
@$out ${tmp}/log1.out w
.clients
@$out ${tmp}/log2.out w
configure add client=${NewClient} address=localhost password=secret
.clients
messages
@$out ${tmp}/log3.out w
reload
.clients
messages
quit
END_OF_DATA

run_susan
check_for_zombie_jobs storage=File1 client=${Client}
stop_susan

grep ${NewClient} ${tmp}/log1.out > /dev/null && set_error "Could not test to add client, as it is already been defined."
grep ${NewClient} ${tmp}/log2.out > /dev/null || set_error "Adding client has not beend successful."
grep ${NewClient} ${tmp}/log3.out > /dev/null || set_error "Added client disappeared after reload."

end_test
